#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main() 
{
    umask(0);
    int fd1 = open("log1.txt", O_WRONLY|O_CREAT|O_APPEND,0666); 
    printf("open success, fd1: %d\n", fd1);
    int fd2 = open("log2.txt", O_WRONLY|O_CREAT|O_APPEND,0666); 
    printf("open success, fd2: %d\n", fd2);
    int fd3 = open("log3.txt", O_WRONLY|O_CREAT|O_APPEND,0666); 
    printf("open success, fd3: %d\n", fd3);
    int fd4 = open("log4.txt", O_WRONLY|O_CREAT|O_APPEND,0666); 
    printf("open success, fd4: %d\n", fd4);
    //if (fd < 0) 
    //{
    //    perror("open");
    //    return 1;
    //}
    //printf("open success, fd: %d\n", fd);
    //char buffer[64];
    //memset(buffer, '0', sizeof(buffer)); 
    //read(fd, buffer, sizeof(buffer)); 
    //printf("%s", buffer); // 输出读取的内容
    close(fd1);
    close(fd2);
    close(fd3);
    close(fd4);
    return 0;
}
